﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace WebApp
{
    public partial class TaskAdd : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["userName"] == null)
            {
                Response.Write("<script>alert('当前还未登录，请登录！！！');location.assign('Login.aspx');</script>");
            }
        }

        protected void sBtn_Click(object sender, EventArgs e)
        {
            var taskName = taskNameTxb.Text.Trim();
            var taskContent = taskContentTxb.Text.Trim();
            var remarks = remarksTxb.Text.Trim();
            var createdUserId = Session["Id"].ToString();

            string sql = string.Format("insert into Task (TaskName,TaskContent,CreatedUserId,Remarks) values ('{0}','{1}',{2},'{3}')",taskName,taskContent,createdUserId,remarks);

            DbHelper.UpdateData(sql);

            Response.Redirect("Default.aspx");
        }

        protected void qxBtn_Click(object sender, EventArgs e)
        {
            Response.Redirect("Default.aspx");
        }
    }
}